home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / MacHaskell 2.2 / com / lispworks / savesys < prev   
Encoding:
Text File  |  1994-09-27  |  2.2 KB  |  66 lines  |  [TEXT/ttxt]

  1. #!/bin/csh
  2. #
  3. # savesys -- build a saved executable in bin/new-lispworks-haskell
  4. #
  5. #
  6. cd $Y2
  7. setenv PRELUDEBIN $Y2/progs/prelude/lispworks
  8. if !(-e $PRELUDEBIN/Prelude.wfasl) then
  9.   echo "Build the prelude first, stupid..."
  10.   exit
  11.   endif
  12. $LISPWORKS <<EOF
  13. ;;; Load the Haskell system.
  14. (load "com/lispworks/patches/safe-fo-closure.wfasl")
  15. (make-package "MUMBLE-IMPLEMENTATION" :use '("LISP"))
  16. (load "cl-support/cl-init")
  17. ;;; Set various internal switches to appropriate values for running
  18. ;;; Haskell code.
  19. (proclaim '(optimize (speed 3) (safety 0) (compilation-speed 0)))
  20. (setf *load-verbose* nil)
  21. (setf *compile-verbose* nil)
  22. (in-package :mumble-user)
  23. (setf *printers* '(compiling loading prompt))
  24. (setf *compile-interface* '#f)
  25. ;;; Load the prelude
  26. (compile/load *prelude-unit-filename*)
  27. ;;; Set up the saved system.
  28. (setf *modules-loaded* '())
  29. (define (haskell-toplevel)
  30.   ;; Need to reset pathname defaults
  31.   (setf lisp:*default-pathname-defaults* (lisp:truename ""))
  32.   (use-vanilla-interface)
  33.   (load-init-files)
  34.   (let ((args  (cdr sys::*line-argument-list*)))
  35.     (if (null? args)
  36.         (do () ('#f)
  37.           (lisp:with-simple-restart (restart-haskell "Restart Haskell.")
  38.             (heval)))
  39.         (lisp:with-simple-restart (restart-haskell "Exit Haskell.")
  40.           (hrun (car args) (cdr args))))))
  41. (define (restart-haskell)
  42.   (lisp:invoke-restart 'restart-haskell))
  43. (define (haskell-debugger-hook c f)
  44.   (declare (ignore f))
  45.   (if *haskell-debug-in-lisp*
  46.       (begin
  47.         (when *haskell-enter-debugger-hook*
  48.           (funcall *haskell-enter-debugger-hook*))
  49.         (lisp:unwind-protect (lisp:invoke-debugger c)
  50.           (when *haskell-exit-debugger-hook*
  51.             (funcall *haskell-exit-debugger-hook*))))
  52.       (begin
  53.         (format '#t "Lisp error:~%~a~%" c)
  54.         (haskell-backtrace)
  55.         (when *haskell-compilation-error-hook*
  56.           (funcall *haskell-compilation-error-hook*))
  57.         (format '#t "Restarting Haskell...~%")
  58.         (restart-haskell))))
  59. (setf lisp:*debugger-hook* (function haskell-debugger-hook))
  60. (lw:save-image "bin/new-lispworks-haskell"
  61.   :gc '#t
  62.   :normal-gc '#f  ; don't reset gc parameters
  63.   :restart-function 'haskell-toplevel)
  64. (lw:bye)
  65. EOF
  66.